package com.hzm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzm.dao.VideoDao;
import com.hzm.entity.Video;
import com.hzm.service.VideoService;
import com.hzm.utils.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: qy137-java
 * @description:
 * @author: 皇子明
 * @create: 2021-10-24 21:53
 **/
@Service
public class VideoServiceImpl extends ServiceImpl<VideoDao, Video> implements VideoService {
    @Resource
    private VideoDao videoDao;
    @Override
    public Result queryAllVideoByCourseId(String id) {
        QueryWrapper<Video> videoWrapper = new QueryWrapper<>();
        videoWrapper.eq("course_id",id);
        videoWrapper.eq("is_free",true);
        List<Video> videos = videoDao.selectList(videoWrapper);
        return new Result(2000,"查询成功",videos);
    }
}
